--alt_u_div DEVICE_FAMILY="Cyclone IV E" LPM_PIPELINE=0 MAXIMIZE_SPEED=5 SKIP_BITS=0 WIDTH_D=2 WIDTH_N=2 WIDTH_Q=2 WIDTH_R=2 denominator numerator quotient remainder
--VERSION_BEGIN 17.0 cbx_cycloneii 2017:04:25:18:06:29:SJ cbx_lpm_abs 2017:04:25:18:06:29:SJ cbx_lpm_add_sub 2017:04:25:18:06:29:SJ cbx_lpm_divide 2017:04:25:18:06:29:SJ cbx_mgl 2017:04:25:18:09:28:SJ cbx_nadder 2017:04:25:18:06:30:SJ cbx_stratix 2017:04:25:18:06:30:SJ cbx_stratixii 2017:04:25:18:06:30:SJ cbx_util_mgl 2017:04:25:18:06:30:SJ  VERSION_END


-- Copyright (C) 2017  Intel Corporation. All rights reserved.
--  Your use of Intel Corporation's design tools, logic functions 
--  and other software and tools, and its AMPP partner logic 
--  functions, and any output files from any of the foregoing 
--  (including device programming or simulation files), and any 
--  associated documentation or information are expressly subject 
--  to the terms and conditions of the Intel Program License 
--  Subscription Agreement, the Intel Quartus Prime License Agreement,
--  the Intel MegaCore Function License Agreement, or other 
--  applicable license agreement, including, without limitation, 
--  that your use is for the sole purpose of programming logic 
--  devices manufactured by Intel and sold by Intel or its 
--  authorized distributors.  Please refer to the applicable 
--  agreement for further details.


FUNCTION add_sub_7pc (dataa[0..0], datab[0..0])
RETURNS ( cout, result[0..0]);
FUNCTION add_sub_8pc (dataa[1..0], datab[1..0])
RETURNS ( cout, result[1..0]);

--synthesis_resources = 
SUBDESIGN alt_u_div_q3f
( 
	denominator[1..0]	:	input;
	numerator[1..0]	:	input;
	quotient[1..0]	:	output;
	remainder[1..0]	:	output;
) 
VARIABLE 
	add_sub_0 : add_sub_7pc;
	add_sub_1 : add_sub_8pc;
	DenominatorIn[8..0]	: WIRE;
	DenominatorIn_tmp[8..0]	: WIRE;
	gnd_wire	: WIRE;
	nose[5..0]	: WIRE;
	NumeratorIn[5..0]	: WIRE;
	NumeratorIn_tmp[5..0]	: WIRE;
	prestg[3..0]	: WIRE;
	quotient_tmp[1..0]	: WIRE;
	sel[5..0]	: WIRE;
	selnose[5..0]	: WIRE;
	StageIn[5..0]	: WIRE;
	StageIn_tmp[5..0]	: WIRE;
	StageOut[3..0]	: WIRE;

BEGIN 
	add_sub_0.dataa[0..0] = NumeratorIn[1..1];
	add_sub_0.datab[0..0] = DenominatorIn[0..0];
	add_sub_1.dataa[] = ( StageIn[2..2], NumeratorIn[2..2]);
	add_sub_1.datab[1..0] = DenominatorIn[4..3];
	DenominatorIn[] = DenominatorIn_tmp[];
	DenominatorIn_tmp[] = ( DenominatorIn[5..0], ( gnd_wire, denominator[]));
	gnd_wire = B"0";
	nose[] = ( B"00", add_sub_1.cout, B"00", add_sub_0.cout);
	NumeratorIn[] = NumeratorIn_tmp[];
	NumeratorIn_tmp[] = ( NumeratorIn[3..0], numerator[]);
	prestg[] = ( add_sub_1.result[], GND, add_sub_0.result[]);
	quotient[] = quotient_tmp[];
	quotient_tmp[] = ( (! selnose[0..0]), (! selnose[3..3]));
	remainder[1..0] = StageIn[5..4];
	sel[] = ( gnd_wire, (sel[5..5] # DenominatorIn[7..7]), gnd_wire, (sel[3..3] # DenominatorIn[4..4]), gnd_wire, (sel[1..1] # DenominatorIn[1..1]));
	selnose[] = ( ((! nose[5..5]) # sel[5..5]), ((! nose[4..4]) # sel[4..4]), ((! nose[3..3]) # sel[3..3]), ((! nose[2..2]) # sel[2..2]), ((! nose[1..1]) # sel[1..1]), ((! nose[0..0]) # sel[0..0]));
	StageIn[] = StageIn_tmp[];
	StageIn_tmp[] = ( StageOut[3..0], B"00");
	StageOut[] = ( ((( StageIn[2..2], NumeratorIn[2..2]) & selnose[3..3]) # (prestg[3..2] & (! selnose[3..3]))), ((( StageIn[0..0], NumeratorIn[1..1]) & selnose[0..0]) # (prestg[1..0] & (! selnose[0..0]))));
END;
--VALID FILE
